home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!zephyr.ens.tek.com!tekred!saab!billr
- From: billr@saab.CNA.TEK.COM (Bill Randle)
- Newsgroups: comp.sources.games
- Subject: v12i006: reve - an othello game, Patch3f
- Message-ID: <6764@tekred.CNA.TEK.COM>
- Date: 21 Dec 90 20:51:44 GMT
- Sender: news@tekred.CNA.TEK.COM
- Lines: 1467
- Approved: billr@saab.CNA.TEK.COM
-
- Submitted-by: Rich Burridge <rburridge@sun.COM>
- Posting-number: Volume 12, Issue 6
- Archive-name: reve/Patch3f
- Patch-To: reve: Volume 11, Issue 52-58
- Environment: SunView, XView, X11R4, termcap
-
-
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 6 (of 9)."
- # Contents: patches03c
- # Wrapped by billr@saab on Fri Dec 21 11:27:26 1990
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'patches03c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'patches03c'\"
- else
- echo shar: Extracting \"'patches03c'\" \(47790 characters\)
- sed "s/^X//" >'patches03c' <<'END_OF_FILE'
- X
- X------- main.c -------
- X*** /tmp/da07594 Sun Dec 9 15:14:38 1990
- X--- main.c Sat Dec 8 19:41:09 1990
- X***************
- X*** 25,37 ****
- X #include "reve.h"
- X #include "color.h"
- X #include "patchlevel.h"
- X! #ifdef SYSV
- X! #include <string.h>
- X! #include <sys/times.h>
- X! #else
- X! #include <strings.h>
- X! #include <sys/time.h>
- X! #endif /*SYSV*/
- X
- X #ifdef X11
- X #include <X11/Xos.h>
- X--- 25,31 ----
- X #include "reve.h"
- X #include "color.h"
- X #include "patchlevel.h"
- X! #include <ctype.h>
- X
- X #ifdef X11
- X #include <X11/Xos.h>
- X***************
- X*** 45,58 ****
- X #endif /*NO_TIMEVAL*/
- X
- X /* Text values for the cyclic buttons. */
- X! char *diff_values[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL } ;
- X! char *notes_values[] = { "off", "on", NULL } ;
- X char *player_values[] = { "human", "computer", NULL } ;
- X
- X enum cantype cmode, last_cmode ;
- X enum disp_type dtype ;
- X enum dpy_type cur_dpyno ;
- X enum set_type direction ; /* Incremental direction for cycle item. */
- X
- X int tx, ty, tw, th ; /* Position and size of text field. */
- X
- X--- 39,65 ----
- X #endif /*NO_TIMEVAL*/
- X
- X /* Text values for the cyclic buttons. */
- X! char *comp_plays[] = { "white", "black", "neither", "both" } ;
- X! char *diff_values[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL } ;
- X! char *notes_values[] = { "off", "on", NULL } ;
- X char *player_values[] = { "human", "computer", NULL } ;
- X
- X+ char *resources[] = { /* Reve X resources read. */
- X+ "animate", /* Boolean: show animation. */
- X+ "bestmove", /* Boolean: show computer best move so far. */
- X+ "difficulty", /* Integer: difficulty level. */
- X+ "last", /* Boolean: show last move (with a square). */
- X+ "log", /* Boolean: write computer info to log file. */
- X+ "notes", /* Boolean: show computer notes. */
- X+ "number", /* Boolean: show last move (number on stone). */
- X+ "quick" /* Boolean: play quick game (don't flip stones). */
- X+ } ;
- X+
- X enum cantype cmode, last_cmode ;
- X enum disp_type dtype ;
- X enum dpy_type cur_dpyno ;
- X enum set_type direction ; /* Incremental direction for cycle item. */
- X+ enum win_type curwin ; /* Window the current event for in. */
- X
- X int tx, ty, tw, th ; /* Position and size of text field. */
- X
- X***************
- X*** 59,75 ****
- X int piece_x ; /* Current X position of moving piece. */
- X int piece_y ; /* Current Y position of moving piece */
- X
- X- int animation ; /* If set, show computer move glide and piece drag. */
- X int best_cmove ; /* Best computer move so far. */
- X int bfont_height ; /* Height in pixels for bold font. */
- X int but_inverted ; /* Value of panel item inverted. */
- X int color ; /* Current color value. */
- X int cur_ch ; /* Current character pressed. */
- X int curx ; /* Current mouse X position. */
- X int cury ; /* Current mouse Y position. */
- X- int do_bestmove ; /* If set, continuously update computers best move. */
- X- int do_last ; /* If set, don't show last move. */
- X- int do_number ; /* If set, the last stone placed is numbered. */
- X int down ; /* Indicates is a mouse button is down. */
- X int first_move = 0 ; /* Set if computer plays first move. */
- X int iconic ; /* Set if window is currently iconic. */
- X--- 66,79 ----
- X int piece_x ; /* Current X position of moving piece. */
- X int piece_y ; /* Current Y position of moving piece */
- X
- X int best_cmove ; /* Best computer move so far. */
- X int bfont_height ; /* Height in pixels for bold font. */
- X int but_inverted ; /* Value of panel item inverted. */
- X+ int cmove_depth ; /* Depth of the current best computer move. */
- X int color ; /* Current color value. */
- X int cur_ch ; /* Current character pressed. */
- X int curx ; /* Current mouse X position. */
- X int cury ; /* Current mouse Y position. */
- X int down ; /* Indicates is a mouse button is down. */
- X int first_move = 0 ; /* Set if computer plays first move. */
- X int iconic ; /* Set if window is currently iconic. */
- X***************
- X*** 94,103 ****
- X int nfont_height ; /* Height in pixels for normal font. */
- X int play_computer ; /* Set if playing against the computer. */
- X int posspec ; /* Set if -Wp or -g option is present (for X11) */
- X! int quickgame ; /* If set, don't flash turning stones. */
- X int saveres = 0 ; /* If set, save computer results to log file. */
- X int show_moves ; /* If set, all possible moves are being shown. */
- X- int show_notes ; /* If set, display notes value from play_reve. */
- X int suggestion = -1 ; /* Positive if a suggested move. */
- X int suggest_x ; /* X position of suggested move. */
- X int suggest_y ; /* Y position of suggested move. */
- X--- 98,107 ----
- X int nfont_height ; /* Height in pixels for normal font. */
- X int play_computer ; /* Set if playing against the computer. */
- X int posspec ; /* Set if -Wp or -g option is present (for X11) */
- X! int processing ; /* If set, computer is procesing a move. */
- X! int props_showing ; /* If set, the property window is visible. */
- X int saveres = 0 ; /* If set, save computer results to log file. */
- X int show_moves ; /* If set, all possible moves are being shown. */
- X int suggestion = -1 ; /* Positive if a suggested move. */
- X int suggest_x ; /* X position of suggested move. */
- X int suggest_y ; /* Y position of suggested move. */
- X***************
- X*** 127,186 ****
- X
- X BOARD moves[64] ; /* Complete array of board moves. */
- X
- X! struct iteminfo items[MAXITEMS] = { /* Panel items. */
- X
- X! /* type x y width height text value function */
- X
- X! { P_BUTTON, BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
- X! BWIDTH, BHEIGHT, "load", 0, draw_textfield },
- X
- X! { P_BUTTON, BBORDER + (1*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
- X! BWIDTH, BHEIGHT, "moves?", 0, show_all_moves },
- X
- X! { P_BUTTON, BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
- X! BWIDTH, BHEIGHT, "new game", 0, new_game },
- X
- X! { P_BUTTON, BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
- X! BWIDTH, BHEIGHT, "save", 0, draw_textfield },
- X
- X! { P_BUTTON, BBORDER + (4*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
- X! BWIDTH, BHEIGHT, "suggest", 0, suggest },
- X
- X! { P_BUTTON, BBORDER + (5*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
- X! BWIDTH, BHEIGHT, "undo", 0, undo },
- X
- X! { P_BUTTON, BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)),
- X! BWIDTH, BHEIGHT, "iconify", 0, done },
- X
- X! { P_BUTTON, -1, -1, /* Not normally active. */
- X! BWIDTH, BHEIGHT, "cancel", 0, remove_textfield },
- X
- X! { P_BUTTON, BBORDER + (5*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)),
- X! BWIDTH, BHEIGHT, "quit", 0, quit },
- X
- X! { P_CYCLE, BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)),
- X! CWIDTH, CHEIGHT, "Black:", 0, init_player },
- X
- X! { P_CYCLE, BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)),
- X! CWIDTH, CHEIGHT, "White:", 1, init_player },
- X
- X! { P_CYCLE, BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (3*(BHEIGHT+BGAP)),
- X! CWIDTH, CHEIGHT, "Difficulty:", INIT_DEPTH, difficulty },
- X
- X! { P_CYCLE, BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (3*(BHEIGHT+BGAP)),
- X! CWIDTH, CHEIGHT, "Notes:", FALSE, init_notes },
- X
- X! { P_MESSAGE, BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (4*(BHEIGHT+BGAP)),
- X! 0, 0, "Use left mouse button to move", 0, NULL },
- X
- X! { P_MESSAGE, BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (5*(BHEIGHT+BGAP)),
- X! 0, 0, "", 0, NULL },
- X
- X! { P_MESSAGE, BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (6*(BHEIGHT+BGAP)),
- X! 0, 0, "White: 2, Black: 2", 0, NULL },
- X
- X! { P_MESSAGE, BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (6*(BHEIGHT+BGAP)),
- X! 0, 0, "", 0, NULL },
- X } ;
- X
- X char geometry[MAXDPY][MAXLINE] ; /* X11 geometry information. */
- X--- 131,376 ----
- X
- X BOARD moves[64] ; /* Complete array of board moves. */
- X
- X! struct iteminfo items[MAXITEMS] = { /* Panel items. */
- X
- X! /* wtype type lx ly Main window items.
- X! * label
- X! * x y
- X! * width height text value
- X! * options nopts
- X! * function
- X! */
- X
- X! { /* load button. */
- X! W_MAIN, P_BUTTON, 0, 0,
- X! "",
- X! BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
- X! BWIDTH, BHEIGHT, "load", 0,
- X! (char **) NULL, 0,
- X! draw_textfield
- X! },
- X
- X! { /* moves? button. */
- X! W_MAIN, P_BUTTON, 0, 0,
- X! "",
- X! BBORDER + (1*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
- X! BWIDTH, BHEIGHT, "moves?", 0,
- X! (char **) NULL, 0,
- X! show_all_moves
- X! },
- X
- X! { /* new game button. */
- X! W_MAIN, P_BUTTON, 0, 0,
- X! "",
- X! BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
- X! BWIDTH, BHEIGHT, "new game", 0,
- X! (char **) NULL, 0,
- X! new_game
- X! },
- X
- X! { /* save button. */
- X! W_MAIN, P_BUTTON, 0, 0,
- X! "",
- X! BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
- X! BWIDTH, BHEIGHT, "save", 0,
- X! (char **) NULL, 0,
- X! draw_textfield
- X! },
- X!
- X! { /* suggest button. */
- X! W_MAIN, P_BUTTON, 0, 0,
- X! "",
- X! BBORDER + (4*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
- X! BWIDTH, BHEIGHT, "suggest", 0,
- X! (char **) NULL, 0,
- X! suggest
- X! },
- X!
- X! { /* undo button. */
- X! W_MAIN, P_BUTTON, 0, 0,
- X! "",
- X! BBORDER + (5*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
- X! BWIDTH, BHEIGHT, "undo", 0,
- X! (char **) NULL, 0,
- X! undo
- X! },
- X!
- X! { /* props button. */
- X! W_MAIN, P_BUTTON, 0, 0,
- X! "",
- X! BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)),
- X! BWIDTH, BHEIGHT, "props", 0,
- X! (char **) NULL, 0,
- X! do_props
- X! },
- X
- X! { /* cancel button. */
- X! W_MAIN, P_BUTTON, 0, 0,
- X! "",
- X! -1, -1, /* Not normally active. */
- X! BWIDTH, BHEIGHT, "cancel", 0,
- X! (char **) NULL, 0,
- X! remove_textfield
- X! },
- X!
- X! { /* quit button. */
- X! W_MAIN, P_BUTTON, 0, 0,
- X! "",
- X! BBORDER + (5*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)),
- X! BWIDTH, BHEIGHT, "quit", 0,
- X! (char **) NULL, 0,
- X! quit
- X! },
- X!
- X! { /* Black player message item. */
- X! W_MAIN, P_MESSAGE,
- X! BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)),
- X! "Black:",
- X! BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)),
- X! CWIDTH, CHEIGHT, "", 0,
- X! (char **) NULL, 0,
- X! NULL
- X! },
- X!
- X! { /* White player message item. */
- X! W_MAIN, P_MESSAGE,
- X! BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)),
- X! "White:",
- X! BBORDER + (5*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)),
- X! CWIDTH, CHEIGHT, "", 1,
- X! (char **) NULL, 0,
- X! NULL
- X! },
- X
- X! { /* Panel message item. */
- X! W_MAIN, P_MESSAGE, 0, 0,
- X! "",
- X! BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (3*(BHEIGHT+BGAP)),
- X! 0, 0, "Use left mouse button to move", 0,
- X! (char **) NULL, 0,
- X! NULL
- X! },
- X
- X! { /* Notes message item. */
- X! W_MAIN, P_MESSAGE, 0, 0,
- X! "",
- X! BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (4*(BHEIGHT+BGAP)),
- X! 0, 0, "", 0,
- X! (char **) NULL, 0,
- X! NULL
- X! },
- X
- X! { /* Score message item. */
- X! W_MAIN, P_MESSAGE, 0, 0,
- X! "",
- X! BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (5*(BHEIGHT+BGAP)),
- X! 0, 0, "White: 2, Black: 2", 0,
- X! (char **) NULL, 0,
- X! NULL
- X! },
- X
- X! { /* Turn message item. */
- X! W_MAIN, P_MESSAGE, 0, 0,
- X! "",
- X! BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (5*(BHEIGHT+BGAP)),
- X! 0, 0, "", 0,
- X! (char **) NULL, 0,
- X! NULL
- X! },
- X
- X! /* wtype type Property window items.
- X! * lx ly
- X! * label
- X! * x y
- X! * width height text value
- X! * options nopts
- X! * function
- X! */
- X
- X! { /* Computer plays choice item. */
- X! W_PROPS, P_CHOICE,
- X! BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
- X! "Computer plays:",
- X! BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
- X! 0, 0, "", 0,
- X! (char **) comp_plays, 4,
- X! set_option
- X! },
- X
- X! { /* Difficulty choice item. */
- X! W_PROPS, P_CHOICE,
- X! BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)),
- X! "Difficulty:",
- X! BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)),
- X! 0, 0, "", 0,
- X! (char **) diff_values, 9,
- X! set_option
- X! },
- X
- X! { /* Set search depth cycle item. */
- X! W_PROPS, P_CYCLE,
- X! BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)),
- X! "Set search depth:",
- X! BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)),
- X! 0, 0, "", INIT_DEPTH,
- X! (char **) NULL, 0,
- X! set_option
- X! },
- X
- X! { /* Options (Animate Move) item. */
- X! W_PROPS, P_TOGGLE,
- X! BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (3*(BHEIGHT+BGAP)),
- X! "Options:",
- X! BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (3*(BHEIGHT+BGAP)),
- X! TICKWIDTH, TICKHEIGHT, "Animate Move", 0,
- X! (char **) NULL, 0,
- X! set_option
- X! },
- X
- X! { /* Options (Show Current Best Move) item. */
- X! W_PROPS, P_TOGGLE, 0, 0,
- X! "",
- X! BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (4*(BHEIGHT+BGAP)),
- X! TICKWIDTH, TICKHEIGHT, "Show Current Best Move", 0,
- X! (char **) NULL, 0,
- X! set_option
- X! },
- X
- X! { /* Options (Show Last Move) item. */
- X! W_PROPS, P_TOGGLE, 0, 0,
- X! "",
- X! BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (5*(BHEIGHT+BGAP)),
- X! TICKWIDTH, TICKHEIGHT, "Show Last Move", 0,
- X! (char **) NULL, 0,
- X! set_option
- X! },
- X
- X! { /* Options (Show Evaluation Info.) item. */
- X! W_PROPS, P_TOGGLE, 0, 0,
- X! "",
- X! BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (6*(BHEIGHT+BGAP)),
- X! TICKWIDTH, TICKHEIGHT, "Show Evaluation Info.", 0,
- X! (char **) NULL, 0,
- X! set_option
- X! },
- X!
- X! { /* Options (Number Last Move) item. */
- X! W_PROPS, P_TOGGLE, 0, 0,
- X! "",
- X! BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (7*(BHEIGHT+BGAP)),
- X! TICKWIDTH, TICKHEIGHT, "Number Last Move", 0,
- X! (char **) NULL, 0,
- X! set_option
- X! },
- X!
- X! { /* Options (Don't Show Flip) item. */
- X! W_PROPS, P_TOGGLE, 0, 0,
- X! "",
- X! BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (8*(BHEIGHT+BGAP)),
- X! TICKWIDTH, TICKHEIGHT, "Don't Show Flip", 0,
- X! (char **) NULL, 0,
- X! set_option
- X! },
- X } ;
- X
- X char geometry[MAXDPY][MAXLINE] ; /* X11 geometry information. */
- X***************
- X*** 197,202 ****
- X--- 387,393 ----
- X int damier[NIVEAUMAX][64] ; /* Boards at different depth level */
- X int tacouleur, macouleur ; /* Your and my colors during evaluation */
- X int mnb, profmax ; /* Number of moves played, current max. depth */
- X+ int max_depth = 2 ; /* Computer strategy - maximum depth. */
- X int vp0, vo0 ; /* Current mobility components */
- X long c1, c2, c3 ; /* Constants used in evaluation function */
- X long edges[6561] ; /* Edges Stability Table */
- X***************
- X*** 213,221 ****
- X--- 404,419 ----
- X STRCPY(progname, argv[0]) ; /* Save program name for later use. */
- X STRCPY(gamefile, "reve.game") ;
- X SPRINTF(line, " Reve. V1.1.%1d", PATCHLEVEL) ;
- X+ init_graphics(&argc, argv) ;
- X initialise() ; /* Initialise variables used by reve. */
- X+ load_resources() ; /* Get resources from various places. */
- X+ read_resources() ; /* Read resources from merged database. */
- X get_options(argc, argv) ; /* Read command line options. */
- X+
- X+ #ifndef XVIEW
- X init_edge_table(edgefile) ; /* Load reve edge table values. */
- X+ #endif /*XVIEW*/
- X+
- X set_display_types() ; /* Work out what displays to initialise. */
- X if (init_ws_type()) /* Determine window system type. */
- X {
- X***************
- X*** 231,236 ****
- X--- 429,448 ----
- X
- X
- X void
- X+ do_computer_move(player)
- X+ int player ;
- X+ {
- X+ set_cursor(CANVASCUR) ;
- X+ if (ANIMATION == TRUE) animate_move(move) ;
- X+ if (best_cmove != -1 && DO_BESTMOVE == TRUE)
- X+ draw_square(best_cmove, IS_OFF, 2) ;
- X+ do_move(player) ;
- X+ last_move = move ;
- X+ cmode = (enum cantype) (OPPONENT(player) + 1) ;
- X+ }
- X+
- X+
- X+ void
- X generate_graphics(argc, argv, dpyno)
- X enum dpy_type dpyno ;
- X int argc ;
- X***************
- X*** 241,255 ****
- X make_frame(argc, argv) ; /* Create reve window/icon. */
- X make_canvas() ; /* Create drawing canvas. */
- X init_fonts() ; /* Load normal and bold fonts. */
- X- create_menu(BLACK_PLAYS, player_values) ;
- X- create_menu(WHITE_PLAYS, player_values) ;
- X- create_menu(DIFFICULTY, diff_values) ;
- X- create_menu(NOTES, notes_values) ;
- X initboard() ;
- X set_cursor(CANVASCUR) ;
- X }
- X
- X
- X void
- X get_options(argc, argv) /* Read and process command line options. */
- X int argc ;
- X--- 453,492 ----
- X make_frame(argc, argv) ; /* Create reve window/icon. */
- X make_canvas() ; /* Create drawing canvas. */
- X init_fonts() ; /* Load normal and bold fonts. */
- X initboard() ;
- X set_cursor(CANVASCUR) ;
- X }
- X
- X
- X+ get_bool_resource(rtype, boolval) /* Get boolean resource from the server. */
- X+ enum res_type rtype ;
- X+ int *boolval ;
- X+ {
- X+ char *val, tempstr[MAXLINE] ;
- X+ int n ;
- X+
- X+ if ((val = get_resource(rtype)) == NULL) return(0) ;
- X+ STRCPY(tempstr, val) ;
- X+ for (n = 0; n < strlen(tempstr); n++)
- X+ if (isupper(tempstr[n])) tempstr[n] = tolower(tempstr[n]) ;
- X+ if (EQUAL(tempstr, "true")) *boolval = TRUE ;
- X+ else *boolval = FALSE ;
- X+ return(1) ;
- X+ }
- X+
- X+
- X+ get_int_resource(rtype, intval) /* Get integer resource from the server. */
- X+ enum res_type rtype ;
- X+ int *intval ;
- X+ {
- X+ char *val ;
- X+
- X+ if ((val = get_resource(rtype)) == NULL) return(0) ;
- X+ *intval = atoi(val) ;
- X+ return(1) ;
- X+ }
- X+
- X+
- X void
- X get_options(argc, argv) /* Read and process command line options. */
- X int argc ;
- X***************
- X*** 265,273 ****
- X switch (argv[0][1])
- X {
- X case 'a' : /* Allow computer glide and piece dragging. */
- X! if (EQUAL(argv[0], "-animate")) animation = TRUE ;
- X break ;
- X! case 'b' : if (EQUAL(argv[0], "-bestmove")) do_bestmove = TRUE ;
- X else if (EQUAL(argv[0], "-black"))
- X {
- X isblack = 1 ;
- X--- 502,510 ----
- X switch (argv[0][1])
- X {
- X case 'a' : /* Allow computer glide and piece dragging. */
- X! if (EQUAL(argv[0], "-animate")) ANIMATION = TRUE ;
- X break ;
- X! case 'b' : if (EQUAL(argv[0], "-bestmove")) DO_BESTMOVE = TRUE ;
- X else if (EQUAL(argv[0], "-black"))
- X {
- X isblack = 1 ;
- X***************
- X*** 284,290 ****
- X getparam(next, argv, "-d needs difficulty") ;
- X level = atoi(next) ;
- X if (level < 1 || level > MAXDIFF) level = INIT_DEPTH ;
- X! items[(int) DIFFICULTY].value = level - 1 ;
- X break ;
- X case 'e' : INC ;
- X getparam(edgefile, argv, "-e needs an edgetable file") ;
- X--- 521,527 ----
- X getparam(next, argv, "-d needs difficulty") ;
- X level = atoi(next) ;
- X if (level < 1 || level > MAXDIFF) level = INIT_DEPTH ;
- X! items[(int) DIFF_CHOICE].value = level - 1 ;
- X break ;
- X case 'e' : INC ;
- X getparam(edgefile, argv, "-e needs an edgetable file") ;
- X***************
- X*** 295,301 ****
- X break ;
- X case 'i' : inv_video = 1 ; /* Display in inverse video. */
- X break ;
- X! case 'l' : if (EQUAL(argv[0], "-last")) do_last = TRUE ;
- X else if (EQUAL(argv[0], "-load"))
- X {
- X INC ; /* Reve game file to load. */
- X--- 532,539 ----
- X break ;
- X case 'i' : inv_video = 1 ; /* Display in inverse video. */
- X break ;
- X! case 'l' : if (EQUAL(argv[0], "-last")) DO_LAST = TRUE ;
- X! else if (EQUAL(argv[0], "-log")) saveres = TRUE ;
- X else if (EQUAL(argv[0], "-load"))
- X {
- X INC ; /* Reve game file to load. */
- X***************
- X*** 306,322 ****
- X case 'm' : monochrome = 1 ; /* Force display to mono. */
- X for (i = 0; i < MAXDPY; i++) iscolor[i] = 0 ;
- X break ;
- X! case 'n' : if (EQUAL(argv[0], "-notes"))
- X! {
- X! show_notes = TRUE ;
- X! items[(int) NOTES].value = 1 ;
- X! }
- X! else if (EQUAL(argv[0], "-number")) do_number = TRUE ;
- X break ;
- X! case 'q' : if (EQUAL(argv[0], "-quick")) quickgame = TRUE ;
- X break ;
- X- case 'r' : saveres = 1 ; /* Save computer results to file. */
- X- break ;
- X case '?' :
- X case 'v' : usage() ;
- X
- X--- 544,554 ----
- X case 'm' : monochrome = 1 ; /* Force display to mono. */
- X for (i = 0; i < MAXDPY; i++) iscolor[i] = 0 ;
- X break ;
- X! case 'n' : if (EQUAL(argv[0], "-notes")) SHOW_NOTES = TRUE ;
- X! else if (EQUAL(argv[0], "-number")) DO_NUMBER = TRUE ;
- X break ;
- X! case 'q' : if (EQUAL(argv[0], "-quick")) QUICKGAME = TRUE ;
- X break ;
- X case '?' :
- X case 'v' : usage() ;
- X
- X***************
- X*** 387,392 ****
- X--- 619,636 ----
- X }
- X
- X
- X+ get_str_resource(rtype, strval) /* Get a string resource from the server. */
- X+ enum res_type rtype ;
- X+ char *strval ;
- X+ {
- X+ char *val ;
- X+
- X+ if ((val = get_resource(rtype)) == NULL) return(0) ;
- X+ STRCPY(strval, val) ;
- X+ return(1) ;
- X+ }
- X+
- X+
- X void
- X getparam(s, argv, errmes)
- X char *s, *argv[], *errmes ;
- X***************
- X*** 407,418 ****
- X int adjust, d, i, n, x, y ;
- X
- X d = (int) cur_dpyno ;
- X! color_area(0, 0, TOTAL_WIDTH, TOTAL_HEIGHT, C_WHITE) ;
- X if (iscolor[d])
- X {
- X! color_area(0, 0, TOTAL_WIDTH, CY, C_BEIGE) ;
- X! color_area(0, CY, TOTAL_WIDTH, TOTAL_WIDTH, C_DBROWN) ;
- X! color_area(0 + BBORDER, CY + BBORDER, BOARD_SIZE * CELL_SIZE,
- X BOARD_SIZE * CELL_SIZE, C_LBROWN) ;
- X }
- X make_panel() ; /* Create panel and panel items. */
- X--- 651,662 ----
- X int adjust, d, i, n, x, y ;
- X
- X d = (int) cur_dpyno ;
- X! color_area(W_MAIN, 0, 0, TOTAL_WIDTH, TOTAL_HEIGHT, C_WHITE) ;
- X if (iscolor[d])
- X {
- X! color_area(W_MAIN, 0, 0, TOTAL_WIDTH, CY, C_BEIGE) ;
- X! color_area(W_MAIN, 0, CY, TOTAL_WIDTH, TOTAL_WIDTH, C_DBROWN) ;
- X! color_area(W_MAIN, 0 + BBORDER, CY + BBORDER, BOARD_SIZE * CELL_SIZE,
- X BOARD_SIZE * CELL_SIZE, C_LBROWN) ;
- X }
- X make_panel() ; /* Create panel and panel items. */
- X***************
- X*** 426,435 ****
- X if (n == 0 || n == BOARD_SIZE) color = C_BLACK ;
- X if (color == C_LGREY) adjust = 1 ;
- X else adjust = 0 ;
- X! draw_line((n*CELL_SIZE)+BBORDER, CY+BBORDER+adjust, /* Vertical. */
- X! (n*CELL_SIZE)+BBORDER,
- X CY+BBORDER+(BOARD_SIZE*CELL_SIZE)-adjust, RSRC, color) ;
- X! draw_line(BBORDER+adjust, CY+BBORDER+(n*CELL_SIZE), /* Horizontal. */
- X BBORDER+(BOARD_SIZE*CELL_SIZE)-adjust,
- X CY+BBORDER+(n*CELL_SIZE), RSRC, color) ;
- X }
- X--- 670,680 ----
- X if (n == 0 || n == BOARD_SIZE) color = C_BLACK ;
- X if (color == C_LGREY) adjust = 1 ;
- X else adjust = 0 ;
- X! draw_line(W_MAIN, (n*CELL_SIZE)+BBORDER, /* Vertical. */
- X! CY+BBORDER+adjust, (n*CELL_SIZE)+BBORDER,
- X CY+BBORDER+(BOARD_SIZE*CELL_SIZE)-adjust, RSRC, color) ;
- X! draw_line(W_MAIN, BBORDER+adjust, /* Horizontal. */
- X! CY+BBORDER+(n*CELL_SIZE),
- X BBORDER+(BOARD_SIZE*CELL_SIZE)-adjust,
- X CY+BBORDER+(n*CELL_SIZE), RSRC, color) ;
- X }
- X***************
- X*** 439,460 ****
- X {
- X color = (iscolor[d]) ? C_WHITE : C_BLACK ;
- X SPRINTF(s1, "%c", 'a' + i) ;
- X! draw_text(BBORDER + (i * CELL_SIZE) + (CELL_SIZE / 2) - 2,
- X CY + BBORDER - 4, BFONT, color, s1) ;
- X! draw_text(BBORDER + (i * CELL_SIZE) + (CELL_SIZE / 2) - 2,
- X CY + (2 * BBORDER) + (BOARD_SIZE * CELL_SIZE) - 4,
- X BFONT, color, s1) ;
- X SPRINTF(sa, "%c", '1' + i) ;
- X! draw_text(BBORDER / 2 - 2, CY + BBORDER + (i * CELL_SIZE) +
- X (CELL_SIZE / 2) + 2, BFONT, color, sa) ;
- X! draw_text(BBORDER + (BOARD_SIZE * CELL_SIZE) + (BBORDER / 2) - 2,
- X CY + BBORDER + (i * CELL_SIZE) + (CELL_SIZE / 2) + 2,
- X BFONT, color, sa) ;
- X }
- X batch(IS_OFF) ;
- X- show_last(last_move, IS_ON) ;
- X- show_number(last_move, IS_ON) ;
- X- show_suggestion() ;
- X batch(IS_ON) ;
- X FOR_BOARD(i)
- X if (board.square[i])
- X--- 684,702 ----
- X {
- X color = (iscolor[d]) ? C_WHITE : C_BLACK ;
- X SPRINTF(s1, "%c", 'a' + i) ;
- X! draw_text(W_MAIN, BBORDER + (i * CELL_SIZE) + (CELL_SIZE / 2) - 2,
- X CY + BBORDER - 4, BFONT, color, s1) ;
- X! draw_text(W_MAIN, BBORDER + (i * CELL_SIZE) + (CELL_SIZE / 2) - 2,
- X CY + (2 * BBORDER) + (BOARD_SIZE * CELL_SIZE) - 4,
- X BFONT, color, s1) ;
- X SPRINTF(sa, "%c", '1' + i) ;
- X! draw_text(W_MAIN, BBORDER / 2 - 2, CY + BBORDER + (i * CELL_SIZE) +
- X (CELL_SIZE / 2) + 2, BFONT, color, sa) ;
- X! draw_text(W_MAIN, BBORDER + (BOARD_SIZE * CELL_SIZE) + (BBORDER / 2) - 2,
- X CY + BBORDER + (i * CELL_SIZE) + (CELL_SIZE / 2) + 2,
- X BFONT, color, sa) ;
- X }
- X batch(IS_OFF) ;
- X batch(IS_ON) ;
- X FOR_BOARD(i)
- X if (board.square[i])
- X***************
- X*** 462,470 ****
- X get_xy(i, &x, &y) ;
- X draw_piece(board.square[i], x, CY+y, RSRC) ;
- X }
- X! batch(IS_OFF) ;
- X set_score() ;
- X message(TURN_MES, "Black to move.") ;
- X
- X if (loadgame)
- X {
- X--- 704,715 ----
- X get_xy(i, &x, &y) ;
- X draw_piece(board.square[i], x, CY+y, RSRC) ;
- X }
- X! if (DO_LAST) show_last(last_move, IS_ON) ;
- X! if (DO_NUMBER) show_number(last_move, 60 - board.moves_left, IS_ON) ;
- X! show_suggestion() ;
- X set_score() ;
- X message(TURN_MES, "Black to move.") ;
- X+ batch(IS_OFF) ;
- X
- X if (loadgame)
- X {
- X***************
- X*** 490,510 ****
- X last_move = -1 ;
- X last_outline = -1 ;
- X next_player = BLACK ;
- X! animation = FALSE ;
- X best_cmove = -1 ;
- X but_inverted = -1 ;
- X! do_bestmove = FALSE ;
- X! do_last = FALSE ;
- X! do_number = FALSE ;
- X! quickgame = FALSE ;
- X validkey = 0 ;
- X cmode = BLACK_START ;
- X show_moves = FALSE ;
- X! show_notes = FALSE ;
- X isblack = 0 ;
- X iswhite = 0 ;
- X level = INIT_DEPTH ;
- X! items[(int) DIFFICULTY].value = level - 1 ;
- X
- X black_dpy = NULL ; /* X11 black piece display information. */
- X white_dpy = NULL ; /* X11 white piece display information. */
- X--- 735,757 ----
- X last_move = -1 ;
- X last_outline = -1 ;
- X next_player = BLACK ;
- X! ANIMATION = FALSE ;
- X best_cmove = -1 ;
- X but_inverted = -1 ;
- X! DO_BESTMOVE = FALSE ;
- X! DO_LAST = FALSE ;
- X! DO_NUMBER = FALSE ;
- X! processing = FALSE ; /* No computer move initially. */
- X! props_showing = FALSE ;
- X! QUICKGAME = FALSE ;
- X validkey = 0 ;
- X cmode = BLACK_START ;
- X show_moves = FALSE ;
- X! SHOW_NOTES = FALSE ;
- X isblack = 0 ;
- X iswhite = 0 ;
- X level = INIT_DEPTH ;
- X! items[(int) DIFF_CHOICE].value = level - 1 ;
- X
- X black_dpy = NULL ; /* X11 black piece display information. */
- X white_dpy = NULL ; /* X11 white piece display information. */
- X***************
- X*** 515,572 ****
- X
- X
- X void
- X! init_edge_table(edgefile) /* Load reve edge table values. */
- X! char *edgefile ;
- X {
- X! char buf[MAXLINE], *getenv(), name[MAXLINE], *paths, *ptr ;
- X! int i, line ;
- X! FILE *fp = NULL ;
- X
- X! i = 0 ;
- X! if ((fp = fopen(edgefile, "r")) == NULL)
- X! {
- X! paths = getenv("PATH") ;
- X! if ((ptr = paths) && edgefile[0] != '/')
- X! for (;;)
- X! if (*ptr == ':' || *ptr == 0)
- X! {
- X! if (*ptr == 0) break ;
- X! name[i++] = '/' ;
- X! name[i] = 0 ;
- X! STRCAT(name, edgefile) ;
- X! if ((fp = fopen(name, "r")) != NULL) break ;
- X! if (*ptr == '\0') break ;
- X! ptr++ ;
- X! i = 0 ;
- X! }
- X! else name[i++] = *ptr++ ;
- X! }
- X
- X! if (fp == NULL)
- X {
- X! FPRINTF(stderr, "Cannot open Edge Stability Table file\n") ;
- X! exit(1) ;
- X }
- X! line = 0 ;
- X! while (fgets(buf, MAXLINE, fp) != NULL)
- X! {
- X! line++ ;
- X! if (buf[0] == '\n' || buf[0] == '#') continue ;
- X! if ((ptr = index(buf, '[')) == NULL)
- X! {
- X! FPRINTF(stderr, "Cannot read edge table file at line %d\n", line) ;
- X! exit(1) ;
- X! }
- X! SSCANF(ptr+1, "%d", &i) ;
- X! if ((ptr = index(buf, '=')) == NULL)
- X! {
- X! FPRINTF(stderr, "Cannot read edge table file at line %d\n", line) ;
- X! exit(1) ;
- X! }
- X! SSCANF(ptr+1, "%ld", &edges[i]) ;
- X! }
- X! FCLOSE(fp) ;
- X! for (i = 0 ; i < 3281; i++) edges[6560 - i] = - edges[i] ;
- X }
- X
- X
- X--- 762,786 ----
- X
- X
- X void
- X! read_resources() /* Read all possible resources from database. */
- X {
- X! int boolval, intval ;
- X
- X! if (get_bool_resource(R_ANIMATE, &boolval)) ANIMATION = boolval ;
- X! if (get_bool_resource(R_BESTMOVE, &boolval)) DO_BESTMOVE = boolval ;
- X
- X! if (get_int_resource(R_DIFFICULTY, &intval))
- X {
- X! level = intval ;
- X! if (level < 1 || level > MAXDIFF) level = INIT_DEPTH ;
- X! items[(int) DIFF_CHOICE].value = level - 1 ;
- X }
- X!
- X! if (get_bool_resource(R_LAST, &boolval)) DO_LAST = boolval ;
- X! if (get_bool_resource(R_LOG, &boolval)) saveres = boolval ;
- X! if (get_bool_resource(R_NOTES, &boolval)) SHOW_NOTES = boolval ;
- X! if (get_bool_resource(R_NUMBER, &boolval)) DO_NUMBER = boolval ;
- X! if (get_bool_resource(R_QUICK, &boolval)) QUICKGAME = boolval ;
- X }
- X
- X
- X***************
- X*** 593,598 ****
- X--- 807,814 ----
- X void
- X set_display_types()
- X {
- X+ int val ;
- X+
- X if (isblack && iswhite) play_computer = 0 ;
- X if (isblack && iswhite) dtype = XBOTH ;
- X else if (isblack) dtype = XBLACK ;
- X***************
- X*** 625,632 ****
- X if (dtype == XBLACK) isblack = 1 ;
- X else if (dtype == XWHITE) iswhite = first_move = 1 ;
- X else if (dtype == XTWO || dtype == XBOTH) isblack = iswhite = 1 ;
- X! items[(int) BLACK_PLAYS].value = (isblack == 0) ;
- X! items[(int) WHITE_PLAYS].value = (iswhite == 0) ;
- X }
- X
- X
- X--- 841,854 ----
- X if (dtype == XBLACK) isblack = 1 ;
- X else if (dtype == XWHITE) iswhite = first_move = 1 ;
- X else if (dtype == XTWO || dtype == XBOTH) isblack = iswhite = 1 ;
- X!
- X! val = (isblack == 0) ;
- X! items[(int) BLACK_PLAYS].value = val ;
- X! STRCPY(items[(int) BLACK_PLAYS].text, player_values[val]) ;
- X!
- X! val = (iswhite == 0) ;
- X! items[(int) WHITE_PLAYS].value = val ;
- X! STRCPY(items[(int) WHITE_PLAYS].text, player_values[val]) ;
- X }
- X
- X
- X***************
- X*** 638,651 ****
- X move = TRUE ; /* Make sure the computer clock is decremented. */
- X best_cmove = -1 ;
- X message(EVAL_MES, "") ;
- X play_reve(board.square, player, level, &move, ¬e) ;
- X! set_cursor(CANVASCUR) ;
- X! if (animation == TRUE) animate_move(move) ;
- X! if (best_cmove != -1 && do_bestmove == TRUE)
- X! draw_square(best_cmove, IS_OFF, 2) ;
- X! do_move(player) ;
- X! last_move = move ;
- X! cmode = (enum cantype) (OPPONENT(player) + 1) ;
- X }
- X
- X
- X--- 860,871 ----
- X move = TRUE ; /* Make sure the computer clock is decremented. */
- X best_cmove = -1 ;
- X message(EVAL_MES, "") ;
- X+ #ifdef XVIEW
- X+ write_to_reve(M_MOVE, board.square, player, level, &move, ¬e) ;
- X+ #else
- X play_reve(board.square, player, level, &move, ¬e) ;
- X! do_computer_move(player) ;
- X! #endif /*XVIEW*/
- X }
- X
- X
- X
- X------- procs.c -------
- X*** /tmp/da07597 Sun Dec 9 15:14:39 1990
- X--- procs.c Sat Dec 8 19:41:37 1990
- X***************
- X*** 29,37 ****
- X
- X
- X void
- X! difficulty()
- X {
- X! level = next_setting(DIFFICULTY, diff_values) + 1 ;
- X }
- X
- X
- X--- 29,39 ----
- X
- X
- X void
- X! do_props()
- X {
- X! props_showing = !props_showing ;
- X! if (props_showing == TRUE) open_frame(W_PROPS) ;
- X! else close_frame(W_PROPS) ;
- X }
- X
- X
- X***************
- X*** 48,60 ****
- X if (state == LEFT_DOWN)
- X {
- X draw_outline(cy * BOARD_SIZE + cx, IS_ON) ;
- X! if (animation == TRUE)
- X draw_piece(next_player, piece_x, piece_y, RINV) ;
- X cmode = (enum cantype) ((int) cmode - 1) ;
- X }
- X else
- X {
- X! if (animation == TRUE)
- X draw_piece(next_player, piece_x, piece_y, RINV) ;
- X draw_outline(last_outline, IS_OFF) ;
- X move = cy * BOARD_SIZE + cx ;
- X--- 50,62 ----
- X if (state == LEFT_DOWN)
- X {
- X draw_outline(cy * BOARD_SIZE + cx, IS_ON) ;
- X! if (ANIMATION == TRUE)
- X draw_piece(next_player, piece_x, piece_y, RINV) ;
- X cmode = (enum cantype) ((int) cmode - 1) ;
- X }
- X else
- X {
- X! if (ANIMATION == TRUE)
- X draw_piece(next_player, piece_x, piece_y, RINV) ;
- X draw_outline(last_outline, IS_OFF) ;
- X move = cy * BOARD_SIZE + cx ;
- X***************
- X*** 64,126 ****
- X
- X
- X void
- X! done()
- X {
- X! iconic = 1 ;
- X! close_frame() ;
- X! }
- X
- X!
- X! void
- X! init_notes()
- X! {
- X! show_notes = next_setting(NOTES, notes_values) ;
- X! if (show_notes == FALSE) message(EVAL_MES, "") ;
- X! }
- X!
- X!
- X! void
- X! init_player()
- X! {
- X! enum panel_type item, other ;
- X! int curi, curo ;
- X!
- X! /* XXX: Currently computer vs computer is not implemented, because of the
- X! * inability to break out of it, once started, with some of the
- X! * graphics versions. If the user has asked for this, then force it
- X! * to toggle the other player, so this situation can't happen.
- X! */
- X!
- X! if (curx < (BBORDER + (3*(BWIDTH+BGAP))))
- X {
- X! item = BLACK_PLAYS ;
- X! other = WHITE_PLAYS ;
- X }
- X- else
- X- {
- X- item = WHITE_PLAYS ;
- X- other = BLACK_PLAYS ;
- X- }
- X- curo = items[(int) other].value ;
- X- curi = next_setting(item, player_values) ;
- X- if (curi == COMPUTER && curo == COMPUTER)
- X- {
- X- curi = HUMAN ;
- X- set_cycle(item, player_values[curi]) ;
- X- items[(int) item].value = curi ;
- X- message(PANEL_MES, "Computer can't play both players.") ;
- X- }
- X- if (curi == HUMAN && curo == COMPUTER)
- X- dtype = (item == BLACK_PLAYS) ? XBLACK : XWHITE ;
- X- else if (curi == COMPUTER && curo == HUMAN)
- X- dtype = (item == BLACK_PLAYS) ? XWHITE : XBLACK ;
- X- else if (curi == HUMAN && curo == HUMAN)
- X- dtype = (dtype == XTWO) ? XTWO : XBOTH ;
- X
- X! if (curi == COMPUTER)
- X! if ((item == BLACK_PLAYS && cmode == BLACK_START) ||
- X! (item == WHITE_PLAYS && cmode == WHITE_START))
- X! computer_move(next_player) ;
- X }
- X
- X
- X--- 66,95 ----
- X
- X
- X void
- X! do_suggest(player, suggestion, note, state)
- X! int player, suggestion, note ;
- X! enum bltype state ;
- X {
- X! set_cursor(CANVASCUR) ;
- X
- X! if (suggestion == -1) return ;
- X! if (best_cmove != -1 && DO_BESTMOVE == TRUE)
- X {
- X! draw_square(best_cmove, IS_OFF, 2) ;
- X! if (DO_NUMBER) show_number(best_cmove, cmove_depth, IS_OFF) ;
- X }
- X
- X! suggest_x = BBORDER + ((suggestion & 7) + 1) * CELL_SIZE - CELL_SIZE / 2 ;
- X! suggest_y = BBORDER + ((suggestion >> 3) + 1) * CELL_SIZE - CELL_SIZE / 2 ;
- X! if (state == IS_OFF)
- X! color = (iscolor[(int) cur_dpyno]) ? C_LBROWN : C_WHITE ;
- X! else color = C_BLACK ;
- X!
- X! draw_line(W_MAIN, suggest_x-5, CY+suggest_y-5,
- X! suggest_x+5, CY+suggest_y+5, RSRC, color) ;
- X! draw_line(W_MAIN, suggest_x-5, CY+suggest_y+5,
- X! suggest_x+5, CY+suggest_y-5, RSRC, color) ;
- X! if (SHOW_NOTES && state == IS_ON) set_eval(player, suggestion, note) ;
- X }
- X
- X
- X***************
- X*** 160,199 ****
- X init_canvas() ;
- X message(EVAL_MES, "") ;
- X message(PANEL_MES, "Use left mouse button to move") ;
- X! draw_button(NEW_GAME_BUT, C_LGREY, BUT_NORMAL) ;
- X }
- X
- X
- X! next_setting(item, choices)
- X! enum panel_type item ;
- X! char *choices[] ;
- X {
- X! switch (direction)
- X {
- X! case INCREMENT : if (choices[++item_value] != NULL)
- X! items[(int) item].value++ ;
- X! else items[(int) item].value = item_value = 0 ;
- X! break ;
- X! case DECREMENT : if (--item_value == -1)
- X! {
- X! while (choices[++item_value] != NULL) continue ;
- X! item_value-- ;
- X! items[(int) item].value = item_value ;
- X! }
- X! else items[(int) item].value-- ;
- X! break ;
- X! case NONE : /* Handled elsewhere. */ ;
- X }
- X! set_cycle(item, choices[item_value]) ;
- X! return(items[(int) item].value) ;
- X }
- X
- X
- X void
- X! quit()
- X {
- X! destroy_frame() ;
- X! exit(0) ;
- X }
- X
- X
- X--- 129,258 ----
- X init_canvas() ;
- X message(EVAL_MES, "") ;
- X message(PANEL_MES, "Use left mouse button to move") ;
- X! draw_button(W_MAIN, NEW_GAME_BUT, C_LGREY, BUT_NORMAL) ;
- X }
- X
- X
- X! void
- X! quit()
- X {
- X! destroy_frame() ;
- X! exit(0) ;
- X! }
- X!
- X!
- X! void
- X! set_computer(val)
- X! int val ;
- X! {
- X! int color, curi ;
- X!
- X! if (val == CP_WHITE)
- X {
- X! dtype = XBLACK ;
- X! play_computer = TRUE ;
- X! items[(int) BLACK_PLAYS].value = HUMAN ;
- X! STRCPY(items[(int) BLACK_PLAYS].text, player_values[HUMAN]) ;
- X! items[(int) WHITE_PLAYS].value = COMPUTER ;
- X! STRCPY(items[(int) WHITE_PLAYS].text, player_values[COMPUTER]) ;
- X }
- X! else if (val == CP_BLACK)
- X! {
- X! dtype = XWHITE ;
- X! play_computer = TRUE ;
- X! items[(int) BLACK_PLAYS].value = COMPUTER ;
- X! STRCPY(items[(int) BLACK_PLAYS].text, player_values[COMPUTER]) ;
- X! items[(int) WHITE_PLAYS].value = HUMAN ;
- X! STRCPY(items[(int) WHITE_PLAYS].text, player_values[HUMAN]) ;
- X! }
- X! else if (val == CP_NEITHER)
- X! {
- X! dtype = XTWO ;
- X! play_computer = FALSE ;
- X! items[(int) BLACK_PLAYS].value = HUMAN ;
- X! STRCPY(items[(int) BLACK_PLAYS].text, player_values[HUMAN]) ;
- X! items[(int) WHITE_PLAYS].value = HUMAN ;
- X! STRCPY(items[(int) WHITE_PLAYS].text, player_values[HUMAN]) ;
- X! }
- X!
- X! color = (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE ;
- X! draw_choice(W_PROPS, COMP_CHOICE, color) ;
- X!
- X! val = items[(int) BLACK_PLAYS].value ;
- X! val = items[(int) WHITE_PLAYS].value ;
- X!
- X! if (next_player == BLACK) curi = items[(int) BLACK_PLAYS].value ;
- X! else curi = items[(int) WHITE_PLAYS].value ;
- X! if (curi == COMPUTER)
- X! if ((next_player == BLACK && cmode == BLACK_START) ||
- X! (next_player == WHITE && cmode == WHITE_START))
- X! computer_move(next_player) ;
- X }
- X
- X
- X void
- X! set_option()
- X {
- X! char str[4] ;
- X! int color, d, maxw, n, val ;
- X!
- X! d = (int) cur_dpyno ;
- X! switch (itemno)
- X! {
- X! case COMP_CHOICE : maxw = items[itemno].width / items[itemno].nopts ;
- X! val = (curx - items[itemno].x) / maxw ;
- X! if (val != CP_BOTH)
- X! {
- X! items[itemno].value = val ;
- X! set_computer(val) ;
- X! }
- X! else message(PANEL_MES,
- X! "Computer plays both is not implemented yet.") ;
- X! break ;
- X!
- X! case DIFF_CHOICE : maxw = items[itemno].width / items[itemno].nopts ;
- X! val = (curx - items[itemno].x) / maxw ;
- X! level = val + 1 ;
- X! items[itemno].value = val ;
- X! color = (iscolor[d]) ? C_BEIGE : C_WHITE ;
- X! draw_choice(W_PROPS, DIFF_CHOICE, color) ;
- X! break ;
- X!
- X! case MAX_DEPTH : val = items[itemno].value ;
- X! if (direction == INCREMENT && val < MAX_PROFMAX)
- X! items[itemno].value++ ;
- X! else if (direction == DECREMENT && val > INIT_DEPTH)
- X! items[itemno].value-- ;
- X! SPRINTF(str, "%d", items[itemno].value) ;
- X! color = (iscolor[d]) ? C_LGREY : C_WHITE ;
- X! set_cycle(W_PROPS, MAX_DEPTH, str) ;
- X! profmax = items[itemno].value ;
- X! level = 1 ;
- X! break ;
- X!
- X! case OPT_ANIM : ANIMATION = !ANIMATION ;
- X! break ;
- X!
- X! case OPT_BEST : DO_BESTMOVE = !DO_BESTMOVE ;
- X! break ;
- X!
- X! case OPT_LAST : DO_LAST = !DO_LAST ;
- X! n = 63 - board.moves_left ;
- X! show_last(moves[n].move, DO_LAST) ;
- X! break ;
- X!
- X! case OPT_EVAL : SHOW_NOTES = !SHOW_NOTES ;
- X! if (!SHOW_NOTES) message(EVAL_MES, "") ;
- X! break ;
- X!
- X! case OPT_NUM : DO_NUMBER = !DO_NUMBER ;
- X! n = 63 - board.moves_left ;
- X! show_number(moves[n].move, 60 - board.moves_left,
- X! DO_NUMBER, DO_NUMBER) ;
- X! break ;
- X!
- X! case OPT_FLIP : QUICKGAME = !QUICKGAME ;
- X! }
- X }
- X
- X
- X***************
- X*** 212,229 ****
- X long note ;
- X
- X if (cmode == GAME_OVER) return ;
- X if (cmode == WHITE_START) player = WHITE ;
- X else player = BLACK ;
- X suggestion = FALSE ; /* Make sure the computer clock isn't decremented. */
- X play_reve(&board.square[0], player, level, &suggestion, ¬e) ;
- X!
- X! suggest_x = BBORDER + ((suggestion & 7) + 1) * CELL_SIZE - CELL_SIZE / 2 ;
- X! suggest_y = BBORDER + ((suggestion >> 3) + 1) * CELL_SIZE - CELL_SIZE / 2 ;
- X! draw_line(suggest_x-5, CY+suggest_y-5,
- X! suggest_x+5, CY+suggest_y+5, RSRC, C_BLACK) ;
- X! draw_line(suggest_x-5, CY+suggest_y+5,
- X! suggest_x+5, CY+suggest_y-5, RSRC, C_BLACK) ;
- X! if (show_notes) set_eval(player, suggestion, note) ;
- X }
- X
- X
- X--- 271,286 ----
- X long note ;
- X
- X if (cmode == GAME_OVER) return ;
- X+ set_cursor(HOURGLASS) ;
- X if (cmode == WHITE_START) player = WHITE ;
- X else player = BLACK ;
- X suggestion = FALSE ; /* Make sure the computer clock isn't decremented. */
- X+ #ifdef XVIEW
- X+ write_to_reve(M_SUGGESTION, board.square, player, level, &move, ¬e) ;
- X+ #else
- X play_reve(&board.square[0], player, level, &suggestion, ¬e) ;
- X! do_suggest(player, suggestion, note, IS_ON) ;
- X! #endif /*XVIEW*/
- X }
- X
- X
- X***************
- X*** 252,266 ****
- X undo_move(player)
- X int player ;
- X {
- X! int i, n, x, y ;
- X
- X! n = 62 - board.moves_left ;
- X! while (moves[n-1].player == player) n-- ;
- X
- X! if (n >= 3)
- X {
- X! show_last(last_move, IS_OFF) ;
- X! show_number(last_move, IS_OFF) ;
- X FOR_BOARD(i)
- X {
- X if (moves[n].square[i] != board.square[i])
- X--- 309,325 ----
- X undo_move(player)
- X int player ;
- X {
- X! int i, limit, n, x, y ;
- X
- X! n = 63 - board.moves_left ;
- X! while (moves[n].player != player) n-- ;
- X
- X! limit = (items[(int) BLACK_PLAYS].value == COMPUTER) ? 4 : 3 ;
- X! if (n >= limit)
- X {
- X! if (DO_LAST) show_last(last_move, IS_OFF) ;
- X! if (DO_NUMBER) show_number(last_move, 60 - board.moves_left, IS_OFF) ;
- X! do_suggest(player, suggestion, note, IS_OFF) ;
- X FOR_BOARD(i)
- X {
- X if (moves[n].square[i] != board.square[i])
- X***************
- X*** 267,273 ****
- X {
- X get_xy(i, &x, &y) ;
- X if (moves[n].square[i] == FREE)
- X! color_area(x, CY+y, PSIZE, PSIZE,
- X (iscolor[(int) cur_dpyno]) ? C_LBROWN : C_WHITE) ;
- X else draw_piece(moves[n].square[i], x, CY+y, RSRC) ;
- X }
- X--- 326,332 ----
- X {
- X get_xy(i, &x, &y) ;
- X if (moves[n].square[i] == FREE)
- X! color_area(W_MAIN, x, CY+y, PSIZE, PSIZE,
- X (iscolor[(int) cur_dpyno]) ? C_LBROWN : C_WHITE) ;
- X else draw_piece(moves[n].square[i], x, CY+y, RSRC) ;
- X }
- X***************
- X*** 290,295 ****
- X--- 349,358 ----
- X
- X timeleft = board.timeleft ;
- X
- X+ #ifdef XVIEW
- X+ reset_time(timeleft) ;
- X+ #endif /*XVIEW*/
- X+
- X if (OPPONENT(player) == BLACK) cmode = BLACK_START ;
- X else cmode = WHITE_START ;
- X message(PANEL_MES, "") ;
- X***************
- X*** 296,304 ****
- X
- X if (n > 3)
- X {
- X! show_last(last_move, IS_ON) ;
- X! show_number(last_move, IS_ON) ;
- X! if (show_notes) set_eval(board.player, board.move, board.note) ;
- X }
- X else message(EVAL_MES, "") ;
- X next_player = OPPONENT(board.player) ;
- X--- 359,367 ----
- X
- X if (n > 3)
- X {
- X! if (DO_LAST) show_last(last_move, IS_ON) ;
- X! if (DO_NUMBER) show_number(last_move, 60 - board.moves_left, IS_ON) ;
- X! if (SHOW_NOTES) set_eval(board.player, board.move, board.note) ;
- X }
- X else message(EVAL_MES, "") ;
- X next_player = OPPONENT(board.player) ;
- X
- END_OF_FILE
- if test 47790 -ne `wc -c <'patches03c'`; then
- echo shar: \"'patches03c'\" unpacked with wrong size!
- fi
- # end of 'patches03c'
- fi
- echo shar: End of archive 6 \(of 9\).
- cp /dev/null ark6isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 9 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-